#include "info.h"
#include "re.h"
#include "utils.h"

void join_m(INFO *info, char *reciev) {

   RE *re;
   char *buffer[5];

   re = (RE *) malloc(sizeof(RE));

   if(matcher("^:([^ ]+)!([^ ])+@[^ ]+ PRIVMSG [^ ]+ :\\.join (.*)$",reciev, re)) {

      buffer[0] = re_copy(re,1,reciev);
      buffer[1] = re_copy(re,3,reciev);

      strtolower(buffer[1]);
      if(strcmp(buffer[0],"z1ppy")==0)
         ssock(info->fd, "JOIN %s\r\n", buffer[1]);

      free(buffer);
   }

}

void onebot_m(INFO *info, char *reciev) {

	join_m(info, reciev);

}
